package com.wjjun.base.data.db;

import android.content.Context;

import com.litesuits.orm.LiteOrm;

import java.util.Collection;

import javax.inject.Inject;

/**
 * Created by asus on 2017/6/13.
 */

public class DBManager implements IDBManager {

    //暂时没用到
    private Context context;

    private LiteOrm liteOrm;

    @Inject
    DBManager(Context context, LiteOrm liteOrm) {
        this.context = context;
        this.liteOrm = liteOrm;
    }

    @Override
    public long save(Object o) {
        return liteOrm.save(o);
    }

    @Override
    public int saveAll(Collection o) {
        return liteOrm.save(o);
    }

    @Override
    public <T> T getById(String id, Class<T> clazz) {
        return liteOrm.queryById(id, clazz);
    }

    @Override
    public <T> T getById(long id, Class<T> clazz) {
        return liteOrm.queryById(id, clazz);
    }

    @Override
    public <T> int delete(Class<T> clazz) {
        return liteOrm.delete(clazz);
    }

    @Override
    public <T> int delete(T o) {
        return liteOrm.delete(o);
    }
}
